package com.lh.factory.tradition.pizzastore.order;

import java.io.BufferedReader;

import java.io.IOException;
import java.io.InputStreamReader;

import com.lh.factory.tradition.pizzastore.pizza.*;
public class OrderPizza {

	// 构造器
	public OrderPizza() {

		//比萨的
		Pizza pizza = null;

		String orderType; // 订购披萨的类型

		do {
			orderType = getType();
			if (orderType.equals("greek")) {
				pizza = new GreekPizza();
				pizza.setName("胡椒披萨");
			} else if (orderType.equals("cheese")) {
				pizza = new CheesePizza();
				pizza.setName("奶酪披萨");

				// 新写的代码
			} else if (orderType.equals("pepper")) {
				pizza = new PepperPizza();
				pizza.setName("希腊披萨");
			} else {
				System.out.println("不存在！");
				break;
			}

			// 输出 Pizza 制作过程
			pizza.prepare();
			pizza.bake();
			pizza.cut();
			pizza.box();

		} while (true);

	}

	// 写一个方法，可以获取客户希望订购的披萨种类
	private String getType() {
		try {
			BufferedReader strin = new BufferedReader(new InputStreamReader(System.in));
			System.out.println("input pizza 种类:");
			String str = strin.readLine();
			return str;
		} catch (IOException e) {
			e.printStackTrace();
			return "";
		}
	}
}